home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmUnzip
- BorderStyle = 1 'Fixed Single
- Caption = "Unzip files"
- ClientHeight = 5730
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 6525
- Icon = "frmUnzip.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5730
- ScaleWidth = 6525
- StartUpPosition = 1 'CenterOwner
- Begin VB.TextBox txtFilesToProcess
- Height = 810
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 2
- Text = "frmUnzip.frx":030A
- ToolTipText = "For multiple choices, seperate each filter with a line feed."
- Top = 1080
- Width = 4815
- End
- Begin VB.CommandButton cmdExtractDirectory
- Caption = "Browse"
- Height = 285
- Left = 4200
- TabIndex = 1
- Top = 360
- Width = 735
- End
- Begin VB.TextBox txtExtractDirectory
- Height = 285
- Left = 120
- TabIndex = 0
- Top = 360
- Width = 3975
- End
- Begin VB.Frame fraDefaultPassword
- Caption = "Password protected files"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1150
- Left = 120
- TabIndex = 15
- Top = 4440
- Width = 3255
- Begin VB.TextBox txtDefaultPassword
- Height = 285
- IMEMode = 3 'DISABLE
- Left = 120
- PasswordChar = "*"
- TabIndex = 9
- Top = 720
- Width = 3015
- End
- Begin VB.Label lblDefaultPassword
- Caption = "Try using the following password for unzipping files:"
- Height = 495
- Left = 120
- TabIndex = 16
- Top = 240
- Width = 3015
- End
- End
- Begin VB.CommandButton cmdFilters
- Caption = "&Filters..."
- Height = 375
- Left = 5160
- TabIndex = 11
- Top = 600
- Width = 1215
- End
- Begin VB.Frame fraSkipping
- Caption = "Do not unzip files that..."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1335
- Left = 120
- TabIndex = 14
- Top = 3000
- Width = 4815
- Begin VB.CheckBox chkSkipIfExisting
- Caption = "Already exist in the destination folder"
- Height = 195
- Left = 120
- TabIndex = 5
- Top = 240
- Width = 3735
- End
- Begin VB.CheckBox chkSkipIfNotExisting
- Caption = "Do not already exist in the destination folder"
- Height = 195
- Left = 120
- TabIndex = 6
- Top = 480
- Width = 3855
- End
- Begin VB.CheckBox chkSkipIfOlderDate
- Caption = "Are older than files already in the destination folder"
- Height = 195
- Left = 120
- TabIndex = 7
- Top = 720
- Width = 4575
- End
- Begin VB.CheckBox chkSkipIfOlderVersion
- Caption = "Are older versions of files already in the destination folder"
- Height = 195
- Left = 120
- TabIndex = 8
- Top = 960
- Width = 4455
- End
- End
- Begin VB.Frame fraFolders
- Caption = "Folder options"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 855
- Left = 120
- TabIndex = 13
- Top = 2040
- Width = 2775
- Begin VB.CheckBox chkPreservePaths
- Caption = "Retrieve paths stored in zip file"
- Height = 195
- Left = 120
- TabIndex = 4
- Top = 480
- Value = 1 'Checked
- Width = 2535
- End
- Begin VB.CheckBox chkProcessSubFolders
- Caption = "Include subfolders"
- Height = 195
- Left = 120
- TabIndex = 3
- Top = 240
- Value = 1 'Checked
- Width = 1935
- End
- End
- Begin VB.CommandButton cmdExtract
- Caption = "&Unzip!"
- Height = 375
- Left = 5160
- TabIndex = 10
- Top = 150
- Width = 1215
- End
- Begin VB.CommandButton cmdCancel
- Caption = "&Cancel"
- Height = 375
- Left = 5160
- TabIndex = 12
- Top = 1050
- Width = 1215
- End
- Begin VB.Label lblFilesToExtract
- Caption = "Specify which files in the zip file you want to unzip:"
- Height = 255
- Left = 120
- TabIndex = 18
- Top = 840
- Width = 4455
- End
- Begin VB.Label lblExtractDirectory
- Caption = "Select the folder where to unzip files to:"
- Height = 255
- Left = 120
- TabIndex = 17
- Top = 120
- Width = 3855
- End
- Attribute VB_Name = "frmUnzip"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '==================================================================
- ' Description: The frmUnzip form is shown when a user choses to unzip
- ' files from a zip file. It lets the user chose the
- ' unzipping folder, which files to unzip, and other
- ' unzipping settings and filter possibilities. If there
- ' are files selected in the main window, they will
- ' automatically be displayed in the frmUnzip window's
- ' list of files to unzip.
- '==================================================================
- Dim xCurrentZip As XceedZip
- '------------------------------------------------------------------------------------
- ' Calls data loading functions
- '------------------------------------------------------------------------------------
- Private Sub LoadExtractProperties(xZip As XceedZip, ListFiles As ListItems)
- Call LoadFileProperties(xZip, ListFiles)
- Call LoadFolderProperties(xZip)
- Call LoadSkippingProperties(xZip)
- ' Loads the default password
- txtDefaultPassword.Text = xZip.EncryptionPassword
- End Sub
- '------------------------------------------------------------------------------------
- ' Loads xZip's File Properties to the corresponding
- ' object on the form. The function also reads the files selected by the user
- ' in the main window and loads them in the txtFilesToProcess textbox.
- '------------------------------------------------------------------------------------
- Private Sub LoadFileProperties(xZip As XceedZip, ListFiles As ListItems)
- Dim sFilesToExtract As String
- txtExtractDirectory.Text = xZip.UnzipToFolder
-
- sFilesToExtract = GetSelectedFiles(ListFiles, True)
- If sFilesToExtract = "" Then
- txtFilesToProcess.Text = xZip.FilesToProcess
- Else
- txtFilesToProcess.Text = sFilesToExtract
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' Initializes the "Include subfolders" and "Store paths in zip file"
- ' controls.
- '------------------------------------------------------------------------------------
- Private Sub LoadFolderProperties(xZip As XceedZip)
- chkProcessSubFolders.Value = Checked
- chkPreservePaths.Value = IIf(xZip.PreservePaths, vbChecked, vbUnchecked)
- End Sub
- '------------------------------------------------------------------------------------
- 'Loads the skipping properties.
- '------------------------------------------------------------------------------------
- Private Sub LoadSkippingProperties(xZip As XceedZip)
- chkSkipIfExisting.Value = xZip.SkipIfExisting
- chkSkipIfNotExisting.Value = xZip.SkipIfNotExisting
- chkSkipIfOlderDate = xZip.SkipIfOlderDate
- chkSkipIfOlderVersion = xZip.SkipIfOlderVersion
- End Sub
- '------------------------------------------------------------------------------------
- ' Shows the frmadd form to the user
- '------------------------------------------------------------------------------------
- Public Function ShowForm(xZip As XceedZip, ListFiles As ListItems) As Boolean
- ' Sets the tag at "0" to later validate if the user clicked on Extract or Cancel
- Tag = "0"
- Height = 4770
- Set xCurrentZip = xZip
- ' Loads xZip's property values to the controls on the form
- Call LoadExtractProperties(xZip, ListFiles)
- ' Shows the window
- frmUnzip.Show vbModal
- ' If the tag's value is "1", then the user clicked on extract and the
- ' values contained in the form are copied in the xZip object.
- If frmUnzip.Tag = "1" Then
- Call UpdateExtractParameters(xZip)
- End If
- ' The function returns true is the user has clicked on Extract.
- ShowForm = (frmUnzip.Tag = "1")
- End Function
- '------------------------------------------------------------------------------------
- 'Calls functions that updates xZip's properties after the Extract button is pressed
- '------------------------------------------------------------------------------------
- Private Sub UpdateExtractParameters(xZip As XceedZip)
- Call UpdateFileProperties(xZip)
- Call UpdateFolderProperties(xZip)
- Call UpdateSkippingProperties(xZip)
- ' Updates the default password
- xZip.EncryptionPassword = txtDefaultPassword.Text
- End Sub
- '------------------------------------------------------------------------------------
- ' Updates xZip's file properties
- '------------------------------------------------------------------------------------
- Private Sub UpdateFileProperties(xZip As XceedZip)
- xZip.UnzipToFolder = txtExtractDirectory
- xZip.FilesToProcess = txtFilesToProcess
- End Sub
- '------------------------------------------------------------------------------------
- ' Updates xZip's Folder properties
- '------------------------------------------------------------------------------------
- Private Sub UpdateFolderProperties(xZip As XceedZip)
- xZip.ProcessSubfolders = chkProcessSubFolders.Value
- xZip.PreservePaths = chkPreservePaths.Value
- End Sub
- '------------------------------------------------------------------------------------
- ' Updates xZip's skipping properties
- '------------------------------------------------------------------------------------
- Private Sub UpdateSkippingProperties(xZip As XceedZip)
- xZip.SkipIfExisting = chkSkipIfExisting
- xZip.SkipIfNotExisting = chkSkipIfNotExisting
- xZip.SkipIfOlderDate = chkSkipIfOlderDate
- xZip.SkipIfOlderVersion = chkSkipIfOlderVersion
- End Sub
- '------------------------------------------------------------------------------------
- ' If cancel is pressed, tag stays at "0"
- '------------------------------------------------------------------------------------
- Private Sub cmdCancel_Click()
- Me.Hide
- End Sub
- '------------------------------------------------------------------------------------
- ' If Extract is clicked, tag takes the "1" value
- '------------------------------------------------------------------------------------
- Private Sub cmdExtract_Click()
- Me.Tag = 1
- Me.Hide
- End Sub
- '------------------------------------------------------------------------------------
- ' If the browse button is pressed, the default directories window
- ' loads up.
- '------------------------------------------------------------------------------------
- Private Sub cmdExtractDirectory_Click()
- Dim PathName As String
- If BrowseForFolder(PathName, "Please select the Extracting Directory") Then
- txtExtractDirectory.Text = PathName
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' If "Other Options" is clicked, the FrmExtractMoreOptions is loaded
- '------------------------------------------------------------------------------------
- Private Sub cmdFilters_Click()
- Call frmFilters.ShowForm(xCurrentZip)
- Call Unload(frmFilters)
- End Sub
-